package com.ghpt.controller;
import com.ghpt.pojo.LuShang;
import com.ghpt.service.LuShangService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/lushang")
public class LuShangController {
    private final LuShangService luShangService;

    public LuShangController(LuShangService luShangService) {
        this.luShangService = luShangService;
    }
    @GetMapping("/{id}")
    public LuShang getLuShangById(@PathVariable Long id) {
        System.out.println("结果是"+luShangService.findLuShangById(id));
        return luShangService.findLuShangById(id);
    }
    @PutMapping
    public int updateLuShang(@RequestBody LuShang luShang) {
        return luShangService.updateById(luShang);
    }
}
